#include <iostream>
#include <stack>
#include <vector>
using namespace std;

//就是最简单的从左向右扫描
int findPeakElement(vector<int>& nums)
{
    stack<int> recstack;
    for (int i = 0; i != nums.size(); ++i) {
	if (recstack.empty() || (nums[i] > nums[recstack.top()])) {
	    recstack.push(i);
	}
    }
    return recstack.top();
}

int findPeakElement2(vector<int>& nums)
{

}
int main()
{
    vector<int> a = { 1, 2, 1, 3, 5, 6, 4 };
    cout << findPeakElement(a) << endl;
}
